#![allow(dead_code)]

struct SpawnLrn {}

impl SpawnLrn {
    pub fn hello() {
        println!("Spawn learning!");
    }
}

#[cfg(test)]
mod tests {
    #[test]
    fn test_spawn() {
        use std::thread;
        use std::time::Duration;

        let handle = thread::spawn(|| {
            for i in 1..10 {
                println!("hi number {} from the spawned thread!", i);
                thread::sleep(Duration::from_millis(1));
            }
        });

        for i in 1..5 {
            println!("hi number {} from the main thread!", i);
            thread::sleep(Duration::from_millis(1));
        }

        handle.join().unwrap();
    }
}
